/*
 * $Id: QEADIFInternal.h 70 2009-06-15 13:57:58Z jon@bway.net $
 * Chalk
 *
 * Created 5/31/09
 * Copyright Jon Gordon
 * 
 * Permission is hereby granted, free of charge, to any person obtaining 
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including 
 * without limitation the rights to use, copy, modify, merge, publish, 
 * distribute, sublicense, and/or sell copies of the Software, and to 
 * permit persons to whom the Software is furnished to do so, subject to 
 * the following conditions:
 * 
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#import "QEADIFShared.h"


/*
 * Regular expressions (using ICU syntax) that validate string
 * representations of the various ADIF data types.  Note that
 * (1) Enumerations (and, by extension, AwardLists) don't have
 * regexes, and (2) the ADIF spec may impose other limitations
 * on values, limitations that a regex can't reasonably capture,
 * but which validation routines may enforce.
 */
#define ADIF_BOOLEAN_REGEX   @"\\A[YN]\\z"
#define ADIF_DIGIT_REGEX     @"\\A[\\x30-\\x39]\\z"
#define ADIF_NUMBER_REGEX    @"\\A-?(?:[\\x30-\\x39]+(?:\\.[\\x30-\\x39]*)?)|(?:\\.[\\x30-\\x39]+)\\z"
#define ADIF_CHARACTER_REGEX @"\\A[\\x20-\\x7e]\\z"
#define ADIF_DATE_REGEX      @"\\A[\\x30-\\x39]{8}\\z"
#define ADIF_TIME_REGEX      @"\\A[\\x30-\\x39]{4}(?:[\\x30-\\x39]{2})?\\z"
#define ADIF_STRING_REGEX    @"\\A[\\x20-\\x7e]*\\z"
#define ADIF_MULTILINE_REGEX @"\\A(?:[\\x20-\\x7e]*\\r\\n)*[\\x20-\\x7e]*\\z"
#define ADIF_LOCATION_REGEX  @"\\A[EWNS][\\x30-\\x39]{3} [\\x30-\\x39]{2}\\.[\\x30-\\x39]{3}\\z"

#define ADIF_ENUMERATION_NAME_REGEX @"\\A[_a-zA-Z]+\\z"
#define ADIF_ENUMERATION_LITERAL_REGEX @"\\A\\s*\\{\\s*[_a-zA-Z]+\\s*(?:,\\s*[_a-zA-Z]\\s*)*\\}\\s*\\z"

/*
 * Defined constants representing the types of ADIF tags
 */
#define ADIF_TAG_END_OF_RECORD @"EOR"
#define ADIF_TAG_END_OF_HEADER @"EOH"
#define ARRL_TAG_END_OF_FILE @"APP_LOTW_EOF"
